The highest priority operator in
10 + 3 * 3 + 5
is *, so it is done first. This gives
10 + 9 + 5
.
Now the remaining + are of equal priority and are done left to right.
10 + 9 + 5 = 19 + 5 = 24
operator |
meaning | priority |
---|---|---|
^ |
power | 1 |
- |
negation | 2 |
* |
multiply | 3 |
/ |
divide | 3 |
+ |
addition | 4 |
- |
subtraction | 4 |
Examine the priority chart again: Notice that * and / have the same priority. When there are several * and /, do them left to right. For example:
12 / 3 * 2 --- all operators have same priority ------ do them left to right 4 * 2 8
The / and * have equal priority. The operators are done left to right.
What is the result of the following?
10 * 2 / 4